<template>
  <div class="box_map">
    <div id="container"></div>
    <div class="con-left">
      <ul class="flex flex-col justify-between">
        <li class="search">
          <input style="width: 10rem; height: 2rem" type="text" placeholder="搜索关键字" />
          <el-button type="primary" class="ml-4">搜索</el-button>
        </li>
        <li class="bianpo_num box">
          <div>边坡数量</div>
          <p class="mt-4 mb-4">1</p>
        </li>
        <li class="bianpo_enum box">
          <div>边坡设备数量</div>
          <p class="mt-4 mb-4">13</p>
        </li>
        <li class="lixian_num box">
          <div>离线设备数量</div>
          <p class="mt-4 mb-4">0</p>
          <p>占比0%</p>
        </li>
        <li class="zaixian_num box">
          <div>在线设备数量</div>
          <p class="mt-4 mb-4">13</p>
          <p>占比100%</p>
        </li>
      </ul>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, onUnmounted } from 'vue'
import AMapLoader from '@amap/amap-jsapi-loader'

let map = null

onMounted(() => {
  AMapLoader.load({
    key: 'ef5c93096717f1cddf33a9af657b52af', // 申请好的Web端开发者Key，首次调用 load 时必填
    version: '2.0', // 指定要加载的 JSAPI 的版本，缺省时默认为 1.4.15
    plugins: [] // 需要使用的的插件列表，如比例尺'AMap.Scale'等
  })
    .then((AMap) => {
      map = new AMap.Map('container', {
        // 设置地图容器id
        viewMode: '3D', // 是否为3D地图模式
        zoom: 11, // 初始化地图级别
        center: [116.397428, 39.90923] // 初始化地图中心点位置
      })
    })
    .catch((e) => {
      console.log(e)
    })
})

onUnmounted(() => {
  map?.destroy()
})
</script>

<style scoped lang="scss">
.box_map {
  position: relative;

  .con-left {
    position: absolute;
    top: 0;
    left: 10;
    border: 1px solid red;
    color: #fff;
    font-size: 24px;

    .search {
      // width: 00px;
      padding: 10px;
      background: #fff;

      input {
        border: 1px solid #777;
      }
    }

    .bianpo_num {
      background: #446bea;
    }

    .bianpo_enum {
      background: #446bea;
    }

    .lixian_num {
      background: #f76b5c;
    }

    .zaixian_num {
      background: #26d193;
    }

    .box {
      display: flex;
      flex-direction: column;
      justify-content: center;
      // align-content: center;
      align-items: center;
      padding: 10px 0;
      margin-top: 10px;
      border-radius: 5px;
    }
  }
}

#container {
  width: 100%;
  height: 800px;
}
</style>
